package com.itheima.reggie.controller;

import com.itheima.reggie.common.R;
import com.itheima.reggie.entity.Orders;
import com.itheima.reggie.service.OrdersService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author GRS
 * @since 2024/4/27 下午10:00
 */
@RestController
@RequestMapping("/order")
public class OrdersController
{
    @Resource
    private OrdersService ordersService;

    /**
     * 用户下单
     */
    @PostMapping("/submit")
    public R<String> placeOrder(@RequestBody Orders orders)
    {
        ordersService.placeOrder(orders);
        return R.success("下单成功");
    }
}